home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 1.0 for Developers / QuickTime 1.0 for Developers.iso / Programming Stuff / Interfaces / Movies Interfaces / Components.h < prev    next >
C/C++ Source or Header  |  1991-09-11  |  8KB  |  270 lines

  1.  
  2. /************************************************************
  3.  
  4. Created: Wednesday, August 14, 1991 at 12:09 PM
  5.  Components.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.  Copyright Apple Computer, Inc. 1990 - 1991
  10.  All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __COMPONENTS__
  16. #define __COMPONENTS__
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21.  
  22.  
  23. enum {
  24.  
  25.  
  26. #define gestaltComponentMgr 'cpnt'
  27.  
  28.  
  29.  kSmallestArray = 1,
  30.  kFix1 = 0x00010000
  31.  
  32. #define DoTheRightThing 0L
  33. };
  34.  
  35. struct ComponentDescription {
  36.  unsigned long componentType;            /* A unique 4-byte code indentifying the command set */
  37.  unsigned long componentSubType;        /* Particular flavor of this instance */
  38.  unsigned long componentManufacturer;    /* Vendor indentification */
  39.  unsigned long componentFlags;            /* 8 each for Component,Type,SubType,Manuf/revision */
  40.  unsigned long componentFlagsMask;        /* Mask for specifying which flags to consider in search, zero during registration */
  41. };
  42.  
  43. typedef struct ComponentDescription ComponentDescription;
  44.  
  45. struct ResourceSpec {
  46.  unsigned long resType;                    /* 4-byte code  */
  47.  short resId;                            /*    */
  48. };
  49.  
  50. typedef struct ResourceSpec ResourceSpec;
  51.  
  52. struct ComponentResource {
  53.  ComponentDescription cd;                /* Registration parameters */
  54.  ResourceSpec component;                /* resource where Component code is found */
  55.  ResourceSpec componentName;            /* name string resource */
  56.  ResourceSpec componentInfo;            /* info string resource */
  57.  ResourceSpec componentIcon;            /* icon resource */
  58. };
  59.  
  60. typedef struct ComponentResource ComponentResource;
  61. typedef ComponentResource *ComponentResourcePtr, **ComponentResourceHandle;
  62.  
  63. /* Structure received by Component:  */
  64. struct ComponentParameters {
  65.  unsigned char flags;                    /* call modifiers: sync/async, deferred, immed, etc */
  66.  unsigned char paramSize;                /* size in bytes of actual parameters passed to this call */
  67.  short what;                            /* routine selector, negative for Component management calls */
  68.  long params[kSmallestArray];            /* actual parameters for the indicated routine */
  69. };
  70.  
  71. typedef struct ComponentParameters ComponentParameters;
  72.  
  73.  
  74. struct ComponentRecord {
  75.  long data[1];
  76. };
  77.  
  78. typedef struct ComponentRecord ComponentRecord;
  79. typedef ComponentRecord *Component;
  80.  
  81. struct ComponentInstanceRecord {
  82.  long data[1];
  83. };
  84.  
  85. typedef struct ComponentInstanceRecord ComponentInstanceRecord;
  86. typedef ComponentInstanceRecord *ComponentInstance;
  87.  
  88.  
  89.  
  90. typedef long ComponentResult;
  91.  
  92. typedef pascal ComponentResult (*ComponentRoutine)
  93.   (ComponentParameters *tp, Handle componentStorage );
  94.  
  95. typedef pascal ComponentResult (*ComponentFunction)();
  96.  
  97.  
  98.  
  99.  
  100.  
  101. #define ComponentCallNow( callNumber, paramSize ) \
  102.   {0x2F3C,paramSize,callNumber,0x7000,0xA82A}
  103.  
  104. #ifdef __cplusplus
  105. extern "C" {
  106. #endif
  107.  
  108. /* 
  109.  *******************************************************
  110.  *                                                     *
  111.  *              APPLICATION LEVEL CALLS                *
  112.  *                                                     *
  113.  *******************************************************
  114.  * Component Database Add, Delete, and Query Routines 
  115.  *******************************************************
  116. */
  117.  
  118. pascal Component RegisterComponent(ComponentDescription *cd,ComponentRoutine componentEntryPoint,
  119.  short global,Handle componentName,Handle componentInfo,Handle componentIcon)
  120.  = {0x7001,0xA82A}; 
  121. pascal Component RegisterComponentResource(ComponentResourceHandle tr,short global)
  122.  = {0x7012,0xA82A}; 
  123. pascal OSErr UnregisterComponent(Component aComponent)
  124.  = {0x7002,0xA82A}; 
  125.  
  126. pascal Component FindNextComponent(Component aComponent,ComponentDescription *looking)
  127.  = {0x7004,0xA82A}; 
  128. pascal long CountComponents(ComponentDescription *looking)
  129.  = {0x7003,0xA82A}; 
  130.  
  131. pascal OSErr GetComponentInfo(Component aComponent,ComponentDescription *cd,
  132.  Handle componentName,Handle componentInfo,Handle componentIcon)
  133.  = {0x7005,0xA82A}; 
  134. pascal long GetComponentListModSeed(void)
  135.  = {0x7006,0xA82A}; 
  136.  
  137.  
  138. /* 
  139.  *******************************************************
  140.  * Component Instance Allocation and dispatch routines 
  141.  *******************************************************
  142. */
  143.  
  144. pascal ComponentInstance OpenComponent(Component aComponent)
  145.  = {0x7007,0xA82A}; 
  146. pascal OSErr CloseComponent(ComponentInstance aComponentInstance)
  147.  = {0x7008,0xA82A}; 
  148.  
  149. pascal OSErr GetComponentInstanceError(ComponentInstance aComponentInstance)
  150.  = {0x700A,0xA82A}; 
  151.  
  152. /*  direct calls to the Components  */
  153. pascal long ComponentFunctionImplemented(ComponentInstance ti,short ftnNumber)
  154.  = {0x2F3C,0x2,0xFFFD,0x7000,0xA82A}; 
  155. pascal long GetComponentVersion(ComponentInstance ti)
  156.  = {0x2F3C,0x0,0xFFFC,0x7000,0xA82A}; 
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160.  
  161.  
  162.  
  163. /*****************************************************
  164. *                                                    *
  165. *               CALLS MADE BY Components             *
  166. *                                                    *
  167. ******************************************************
  168. ******************************************************
  169. * Required Component routines
  170. *******************************************************/
  171.  
  172.  
  173. #define kComponentOpenSelect -1            /* ComponentInstance for this open */
  174. #define kComponentCloseSelect -2        /* ComponentInstance for this close */
  175. #define kComponentCanDoSelect -3        /* selector # being queried */
  176. #define kComponentVersionSelect -4        /* no params */
  177. #define kComponentRegisterSelect -5        /* no params */
  178. #define kComponentTargetSelect -6        /* ComponentInstance for top of call chain */
  179.  
  180. #ifdef __cplusplus
  181. extern "C" {
  182. #endif
  183.  
  184. /* 
  185.  *******************************************************
  186.  * Component Management routines
  187.  *******************************************************
  188. */
  189.  
  190. pascal void SetComponentInstanceError(ComponentInstance aComponentInstance,
  191.  OSErr theError)
  192.  = {0x700B,0xA82A}; 
  193.  
  194. pascal long GetComponentRefcon(Component aComponent)
  195.  = {0x7010,0xA82A}; 
  196. pascal void SetComponentRefcon(Component aComponent,long theRefcon)
  197.  = {0x7011,0xA82A}; 
  198.  
  199. pascal short OpenComponentResFile(Component aComponent)
  200.  = {0x7015,0xA82A}; 
  201. pascal OSErr CloseComponentResFile(short refnum)
  202.  = {0x7018,0xA82A}; 
  203.  
  204.  
  205. /* 
  206.  *******************************************************
  207.  * Component Instance Management routines
  208.  *******************************************************
  209. */
  210.  
  211. pascal Handle GetComponentInstanceStorage(ComponentInstance aComponentInstance)
  212.  = {0x700C,0xA82A}; 
  213. pascal void SetComponentInstanceStorage(ComponentInstance aComponentInstance,
  214.  Handle theStorage)
  215.  = {0x700D,0xA82A}; 
  216.  
  217. pascal long GetComponentInstanceA5(ComponentInstance aComponentInstance)
  218.  = {0x700E,0xA82A}; 
  219. pascal void SetComponentInstanceA5(ComponentInstance aComponentInstance,
  220.  long theA5)
  221.  = {0x700F,0xA82A}; 
  222.  
  223. pascal long CountComponentInstances(Component aComponent)
  224.  = {0x7013,0xA82A}; 
  225.  
  226. pascal ComponentInstance FindNextCommonComponentInstance(ComponentInstance ti,
  227.  Component t,ComponentRoutine commonEntryPoint)
  228.  = {0x7014,0xA82A}; 
  229.  
  230. /*  useful helper routines for convenient method dispatching  */
  231. pascal long CallComponentFunction(ComponentParameters *params,ComponentFunction func)
  232.  = {0x70FF,0xA82A}; 
  233. pascal long CallComponentFunctionWithStorage(Handle storage,ComponentParameters *params,
  234.  ComponentFunction func)
  235.  = {0x70FF,0xA82A}; 
  236. pascal long DelegateComponentCall(ComponentParameters *originalParams,ComponentInstance ti)
  237.  = {0x7024,0xA82A}; 
  238. #ifdef __cplusplus
  239. }
  240. #endif
  241. enum {
  242.  
  243.  
  244. /* Set Default Component flags */
  245.  defaultComponentIdentical = 0,
  246.  defaultComponentAnyFlags = 1,
  247.  defaultComponentAnyManufacturer = 2,
  248.  defaultComponentAnySubType = 4
  249.  
  250. #define defaultComponentAnyFlagsAnyManufacturer defaultComponentAnyFlags+defaultComponentAnyManufacturer
  251. #define defaultComponentAnyFlagsAnyManufacturerAnySubType defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
  252. };
  253.  
  254. #ifdef __cplusplus
  255. extern "C" {
  256. #endif
  257. pascal OSErr SetDefaultComponent(Component aComponent,short flags)
  258.  = {0x701E,0xA82A}; 
  259. pascal ComponentInstance OpenDefaultComponent( long componentType, long componentSubType )
  260.  = {0x7021,0xA82A}; 
  261. pascal Component CaptureComponent(Component capturedComponent,Component capturingComponent)
  262.  = {0x701C,0xA82A}; 
  263. pascal OSErr UncaptureComponent(Component aComponent)
  264.  = {0x701D,0xA82A}; 
  265. #ifdef __cplusplus
  266. }
  267. #endif
  268.  
  269. #endif
  270.